********************************************************************************************************
*                                                                                                      *
*                                               MAIN.DO                                                *
*                                                                                                      *
* Calls and executes all the programs for project Cuciniello-Michelacci-Paciello                                                     *
********************************************************************************************************
*
/* Last modified: December 09, 2024 */
********************************************
*
clear all
set more off
set matsize 5000
capture log close
*

*
global numdec=2 /* Number of decimals for coefficients in tables*/
global numdec_se=2 /* Number of decimals for standard errors in tables*/
global label=1 /* Labels variables in tables */

**************************************************************************************************
*
* Install ado files needed for the estimation (if missing)
local required_ados "ftools geo2xy hdfe ivreg2 kountry mif2dta outreg2 ranktest reghdfe regife shp2dta spmap xtivreg2 distmatch" //add the required ados here//
foreach x of local reqeretuired_ados {
	capture findfile `x'.ado		
		if _rc==601 {
			ssc install `x'
		}
} 




*
**************************************************************************************************
/* FILES PATHS */

	global apath /home/user/...  /*NEED TO CHANGE DIRECTORY*/
	global versionsave "version(12)"
	global graphsave "pdf"


global data "$apath/DataFinal"    /*NEED TO CHANGE DIRECTORY*/
global figures "$apath/figures"   /*NEED TO CHANGE DIRECTORY*/
global tables "$apath/tables"     /*NEED TO CHANGE DIRECTORY*/
global tablesSlide "$apath/tablesSlide"   /*NEED TO CHANGE DIRECTORY*/
global temp "$apath/temp"			/*NEED TO CHANGE DIRECTORY*/
global code "$apath"


*
**************************************************************************************************
set more off 
set scheme s1color



do "$code/descriptive_dataset.do"

do "$code/event_study_dataset.do" 

do "$code/Createdataset.do"
/* Descriptive evidence: Table and Map*/


do "$code/FinalCalibrationV1.do"
/* Descriptive evidence: AgeProfile*/
do "$code/FinalAgeProfileV1.do"
/* Effects of subsidy */
do "$code/FinalEffectSubsidyV1.do"
/*Evidence on reimbursement effect*/
do "$code/FinalEventSubsidyV1.do"




